﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace VoltGameEditor
{
	public partial class progBarModal : Form
	{
		public progBarModal()
		{
			InitializeComponent();
		}

		delegate string SetUpdate(int minCount, int maxCount, int value, string status);

		private void progBarModal_Load(object sender, EventArgs e)
		{
			
		}

		public string UpdateProgbar(int minCount, int maxCount, int value, string status)
		{
			this.ShowDialog();
			if (progBar.InvokeRequired)
			{
				SetUpdate su = new SetUpdate(UpdateProgbar);
				this.progBar.Invoke(su, new object[] { Text });
			}
			else
			{
				if (minCount < 0)
					minCount = 0;
				if (value < minCount || value > maxCount)
					return "Error : Value is not within range of min & max.";
				if (status == "")
					return "Error : Status cannot be emtpy";
				else
					Program.PbModal.tlbl_status.Text = status;
			}
			
				
			Program.PbModal.progBar.Value = value;
			Program.PbModal.tlbl_per.Text = value.ToString() + "%";

			return null;
		}
	}
}
